class MemberCardDetailsController < ApplicationController
  def new
  	@member_card_detail = MemberCardDetail.new
    @packages = Package.all
  end

  def create
  	@member_card_detail = MemberCardDetail.new post_params
    if @member_card_detail.save
       redirect_to member_card_path(:id =>@member_card_detail.member_card.id)
    else
      render :action => 'new'
    end
  end

  def destroy
    @member_card_detail = MemberCardDetail.find params[:id]
    @member_card_detail.destroy
    redirect_to member_card_path(:id =>@member_card_detail.member_card.id)
  end

  def post_params
    params.require(:member_card_detail).permit(*%w(member_card_id package_id times))
  end
end
